package com.hsnn.medstgmini.sys.model;

import java.io.Serializable;
import java.sql.Blob;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.springframework.format.annotation.DateTimeFormat;
/**
 * @category 公告实体类
 * @author 韩守松
 * @date 2015年11月27日
 */
@Entity
@Table(name="sys_notice")
public class SysNotice implements Serializable{
	
	private static final long serialVersionUID = 1L;
	private String sysNoticeId;//公告id
	private String sysNoticeCode;//公告code
	private String title;//公告标题
	private String org;//组织机构
	private String content;//内容
	private Blob blobContent;//blob内容
	private Date dateTime;//时间
	private String dateTimeStr;//时间STRING
	private String url;//附件路径
	private int readCount;//读取数量
	private Date updDateTime;//更新时间
	private String updUser;//更新人
	private int status;//状态
	
	
	@Id
	@Column(name="sys_notice_id")
	public String getSysNoticeId() {
		return sysNoticeId;
	}
	public void setSysNoticeId(String sysNoticeId) {
		this.sysNoticeId = sysNoticeId;
	}
	
	@Column(name="sys_notice_code")
	public String getSysNoticeCode() {
		return sysNoticeCode;
	}
	public void setSysNoticeCode(String sysNoticeCode) {
		this.sysNoticeCode = sysNoticeCode;
	}
	
	@Column(name="title")
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	
	@Column(name="org")
	public String getOrg() {
		return org;
	}
	public void setOrg(String org) {
		this.org = org;
	}
	
	@Transient
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	@Column(name="content")
	public Blob getBlobContent() {
		return blobContent;
	}
	public void setBlobContent(Blob blobContent) {
		this.blobContent = blobContent;
	}
	
	@DateTimeFormat(pattern="yyyy-MM-dd")
	@Column(name="datetime")
	public Date getDateTime() {
		return dateTime;
	}
	public void setDateTime(Date dateTime) {
		this.dateTime = dateTime;
	}
	
	@Column(name="url")
	public String getUrl() {
		return url;
	}
	
	public void setUrl(String url) {
		this.url = url;
	}
	
	@Column(name="read_count")
	public int getReadCount() {
		return readCount;
	}
	public void setReadCount(int readCount) {
		this.readCount = readCount;
	}
	
	@Column(name="upd_datetime")
	public Date getUpdDateTime() {
		return updDateTime;
	}
	public void setUpdDateTime(Date updDateTime) {
		this.updDateTime = updDateTime;
	}
	
	@Column(name="upd_user")
	public String getUpdUser() {
		return updUser;
	}
	
	public void setUpdUser(String updUser) {
		this.updUser = updUser;
	}
	
	@Column(name="status")
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	@Transient
	public String getDateTimeStr() {
		return dateTimeStr;
	}
	public void setDateTimeStr(String dateTimeStr) {
		this.dateTimeStr = dateTimeStr;
	}
	@Override
	public String toString() {
		return "SysNotice [sysNoticeId=" + sysNoticeId + ", sysNoticeCode="
				+ sysNoticeCode + ", title=" + title + ", org=" + org
				+ ", content=" + content + ", blobContent=" + blobContent
				+ ", dateTime=" + dateTime + ", dateTimeStr=" + dateTimeStr
				+ ", url=" + url + ", readCount=" + readCount
				+ ", updDateTime=" + updDateTime + ", updUser=" + updUser
				+ ", status=" + status + "]";
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((blobContent == null) ? 0 : blobContent.hashCode());
		result = prime * result + ((content == null) ? 0 : content.hashCode());
		result = prime * result
				+ ((dateTime == null) ? 0 : dateTime.hashCode());
		result = prime * result
				+ ((dateTimeStr == null) ? 0 : dateTimeStr.hashCode());
		result = prime * result + ((org == null) ? 0 : org.hashCode());
		result = prime * result + readCount;
		result = prime * result + status;
		result = prime * result
				+ ((sysNoticeCode == null) ? 0 : sysNoticeCode.hashCode());
		result = prime * result
				+ ((sysNoticeId == null) ? 0 : sysNoticeId.hashCode());
		result = prime * result + ((title == null) ? 0 : title.hashCode());
		result = prime * result
				+ ((updDateTime == null) ? 0 : updDateTime.hashCode());
		result = prime * result + ((updUser == null) ? 0 : updUser.hashCode());
		result = prime * result + ((url == null) ? 0 : url.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SysNotice other = (SysNotice) obj;
		if (blobContent == null) {
			if (other.blobContent != null)
				return false;
		} else if (!blobContent.equals(other.blobContent))
			return false;
		if (content == null) {
			if (other.content != null)
				return false;
		} else if (!content.equals(other.content))
			return false;
		if (dateTime == null) {
			if (other.dateTime != null)
				return false;
		} else if (!dateTime.equals(other.dateTime))
			return false;
		if (dateTimeStr == null) {
			if (other.dateTimeStr != null)
				return false;
		} else if (!dateTimeStr.equals(other.dateTimeStr))
			return false;
		if (org == null) {
			if (other.org != null)
				return false;
		} else if (!org.equals(other.org))
			return false;
		if (readCount != other.readCount)
			return false;
		if (status != other.status)
			return false;
		if (sysNoticeCode == null) {
			if (other.sysNoticeCode != null)
				return false;
		} else if (!sysNoticeCode.equals(other.sysNoticeCode))
			return false;
		if (sysNoticeId == null) {
			if (other.sysNoticeId != null)
				return false;
		} else if (!sysNoticeId.equals(other.sysNoticeId))
			return false;
		if (title == null) {
			if (other.title != null)
				return false;
		} else if (!title.equals(other.title))
			return false;
		if (updDateTime == null) {
			if (other.updDateTime != null)
				return false;
		} else if (!updDateTime.equals(other.updDateTime))
			return false;
		if (updUser == null) {
			if (other.updUser != null)
				return false;
		} else if (!updUser.equals(other.updUser))
			return false;
		if (url == null) {
			if (other.url != null)
				return false;
		} else if (!url.equals(other.url))
			return false;
		return true;
	}
	
	
	
}
